Fix fuzz harness panic on malformed options input#18179
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…sing to prevent slice bounds panic Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix fuzz job harness panic on malformed options
Fix fuzz harness panic on malformed options input
Feb 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a panic in the FuzzParseInputDefinition harness that occurred when processing malformed options input. The harness was attempting to strip quotes from option values without first verifying the string was long enough, causing a "slice bounds out of range" panic on truncated inputs like {"options":[" ].
Changes:
- Added a length guard (
len(part) >= 2) before stripping quotes from option tokens - Added a regression test case to the seed corpus with the malformed input that triggered the original panic
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
FuzzParseInputDefinitionharness panicked before reaching the parser when given truncated options input like{"options":[" ]. The options-parsing loop extracted a single"character, which passed theHasPrefix/HasSuffixquote check but causedpart[1:len(part)-1]→part[1:0]to panic with "slice bounds out of range".Changes
pkg/workflow/workflow_dispatch_inputs_fuzz_test.golen(part) >= 2before applyingHasPrefix/HasSuffix:{"options":[" ]to the seed corpus to prevent regressionOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.